new Event Session
Starts a new event session with a custom, user-provided identifier.
An event session is a mechanism to group a sequence of related events (tracked via track or track) under a common context. Subsequent calls to tracking methods will associate events with this newly started session until another newEventSession
call is made or the session implicitly ends (e.g., due to player restart or a predefined timeout, if applicable).
Using this method allows you to define specific session IDs that may have meaning in your external analytics systems or for correlating events across different parts of your application or even different devices if the ID is shared.
If a session is already active, starting a new session with this method will typically terminate the existing session and begin a new one with the given id
. Ensure the provided id
is unique and meaningful for your tracking purposes.
Parameters
The non-null, custom string identifier for the new event session. This ID will be associated with all subsequent tracked events until a new session is started. It is recommended to use IDs that are unique and meaningful for later analysis.
See also
For starting a session with an auto-generated ID.
Throws
if id
is null.
if id
is empty or does not meet format requirements (if any, these should be specified).
Starts a new event session with an automatically generated, unique identifier.
An event session serves to group a series of related events (tracked via track or track) under a common context. All subsequent calls to tracking methods will associate events with this new session until another newEventSession
call is made or the session implicitly ends.
This method is convenient when you need to start a new logical grouping of events but do not require a specific, externally defined session ID. The player will generate an ID that is unique for the current player instance and session.
If a session is already active, invoking this method will typically terminate the existing session and initiate a new one with the auto-generated ID. The generated session ID is returned, allowing you to log it or use it for reference if needed.
Return
A non-null, unique string identifier automatically generated for the new event session. This ID will be associated with all subsequent tracked events.
See also
For starting a session with a custom ID.